package com.dfrz.planeclub.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dfrz.planeclub.mapper.AdminMapper;
import com.dfrz.planeclub.pojo.Admin;
import com.dfrz.planeclub.pojo.User;
import com.dfrz.planeclub.service.AdminService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author PuXiaLing
 * @description: TODO
 * @date 2024/4/15 17:12
 */
@Service
public class AdminServiceImpl implements AdminService {
    @Resource
    AdminMapper adminMapper;

    /**
     * 管理员账号登录
     * @param adminer
     * @return
     */
    @Override
    public Admin accLogin(Admin adminer) {
        QueryWrapper<Admin> wrapper=new QueryWrapper<>();
//       通过账号查管理员
        wrapper.eq("account",adminer.getAccount());
        Admin admin=adminMapper.selectOne(wrapper);
        if (admin!=null&&admin.getPassword().equals(adminer.getPassword())&&admin.getType().equals(adminer.getType())){
            return admin;
        }
        return null;
    }
}
